﻿#ifndef LOGGER_H
#define LOGGER_H

#include "../../include/ilogger.h"

class Logger : public ILogger
{
    Q_OBJECT
public:
    static Logger* GetInstance() {static Logger __instance; return &__instance;}
public:
    Logger();
    virtual ~Logger();
    virtual int Init();
    virtual int UnInit();
    virtual int SetFramework(IFramework* pFrm);
    virtual void WriteLog(QString szLog);

private:
    void writeLogger(const char *szLog);
    enum __logType
    {
        logger_min = 0,
        logger_log,
        logger_max,
    };

    QThread     m_thread;
    QFile       m_file;
    QString     m_szLog;
    bool        m_IsOpenLog;
    IFramework  *m_pFramework;
signals:
    void sigPostTrdMsg(int nType, QString msg);
private slots:
    void slotGetTrdMsg(int nType, QString msg);
};
#endif // LOGGER_H
